package java_DesignPattern.BehavioralPattern.CommandPattern;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务员类
 */
public class Waitor {

    //内聚命令对象
    private List<Command> commands = new ArrayList<>();

    //添加命令
    public void addCommand(Command command) {
        commands.add(command);
    }

     //通知执行命令
    public void notifyCommand() {
        for (Command command : commands) {
            command.execute();
        }
    }
}
